home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / tch_tpas.zip / PROG8.PAS < prev    next >
Pascal/Delphi Source File  |  1986-04-05  |  1KB  |  51 lines

  1. PROGRAM PROG8;
  2. {$U+      Copyright (C), 1985 by Lyle Faurot.  All rights reserved.
  3.  
  4.     New Topics: CASE statement
  5.                 Block statement
  6. }
  7.  
  8. VAR
  9.   Response         : Char;
  10.   Correct_Response : Boolean;
  11.  
  12. BEGIN
  13.   WriteLn('Turbo Pascal seems to ');
  14.   WriteLn;
  15.   WriteLn('A. Run faster than other Pascals.');
  16.   WriteLn('B. Compile faster than others.');
  17.   WriteLn('C. Take less room in memory.');
  18.   WriteLn('D. All of the above.');
  19.   WriteLn;
  20.  
  21.   REPEAT
  22.       Write('Enter your choice - A, B, C, or D: ');
  23.       ReadLn(Response);
  24.       WriteLn;
  25.  
  26.       CASE Response OF
  27.         'A','a',
  28.         'B','b',
  29.         'C','c'    :  BEGIN
  30.                         WriteLn('Correct, but not the best answer.');
  31.                         WriteLn('Please try again.');
  32.                         Correct_Response := False;
  33.                       END;
  34.  
  35.         'D','d'    :  BEGIN
  36.                         WriteLn('Correct - these all seem to be true.');
  37.                         Correct_Response := True;
  38.                       END;
  39.       ELSE
  40.         BEGIN
  41.           WriteLn(Response,' was not one of the choices. Try again.');
  42.           Correct_Response := False;
  43.         END;
  44.  
  45.       END; {CASE}
  46.  
  47.   UNTIL Correct_Response;
  48.  
  49.  
  50. END.
  51.